import 'package:flutter/material.dart';
import 'package:platform_service/platform_service.dart';

class CommonScannerPage extends StatefulWidget {
  const CommonScannerPage({Key? key}) : super(key: key);

  @override
  State<CommonScannerPage> createState() => _CommonScannerPageState();
}

class _CommonScannerPageState extends State<CommonScannerPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Stack(
        children: [
          NDScannerWidget(
            continueScan: true,
            onResult: (value) {
              print('scan result = $value');
              ScaffoldMessenger.of(context)
                  .showSnackBar(SnackBar(content: Text(value ?? '')));
            },
          ),
          Padding(
            padding: EdgeInsets.only(
                left: 0, top: MediaQuery.of(context).padding.top),
            child: IconButton(
              iconSize: 24,
              icon: const Icon(
                Icons.arrow_back,
                color: Colors.white,
              ),
              onPressed: () {
                Navigator.of(context).pop();
              },
            ),
          ),
        ],
      ),
    );
  }
}
